package com.woniuxy.intellihome.mapper;

import com.woniuxy.intellihome.entity.Review;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2021-08-11
 */
public interface ReviewMapper extends BaseMapper<Review> {

    //增加评论
    @Insert("insert into m_review (content,type,time,user_id,sku_id) values(#{content},#{type},#{time},#{userId},#{skuId})")
    void addReview(@Param("content") String content, @Param("type") String type, @Param("time") String time, @Param("userId") int userId, @Param("skuId") int skuId);

    @Select("select * from m_review where sku_id=#{sku_id}")
    List<Review> getBySkuid(int sku_id);
}
